Link rel=modulepreload: Support integrity attribute This CL enables subresource integrity check for link rel=modulepreload, by passing integrity value to ScriptFetchOptions. Note that this is only for modulepreload; integrity is still not supported for link rel=preload (crbug.com/677022). Bug: 740886 Change-Id: I09159ed802e49b402e71ff464dee56a380a73b07 Reviewed-on: https://chromium-review.googlesource.com/773719 Reviewed-by: Kinuko Yasuda <kinuko@chromium.org> Reviewed-by: Kouhei Ueno <kouhei@chromium.org> Commit-Queue: Kunihiko Sakamoto <ksakamoto@chromium.org> Cr-Commit-Position: refs/heads/master@{#518037} 
diff --git a/preload/modulepreload.html b/preload/modulepreload.html index 5b70bc8..6a17050 100644 --- a/preload/modulepreload.html +++ b/preload/modulepreload.html 
@@ -104,5 +104,21 @@  return attachAndWaitForError(link);  }, 'link rel=modulepreload with invalid as= value');   +promise_test(function(t) { + var link = document.createElement('link'); + link.rel = 'modulepreload'; + link.href = 'resources/module1.js?integrity-match'; + link.integrity = 'sha256-ZPBZ+J9CiHzZXaBBluSeCpjzuTUkT+rSWIdXUV3AtVo=' + return attachAndWaitForLoad(link); +}, 'link rel=modulepreload with integrity match'); + +promise_test(function(t) { + var link = document.createElement('link'); + link.rel = 'modulepreload'; + link.href = 'resources/module1.js?integrity-doesnotmatch'; + link.integrity = 'sha384-doesnotmatch' + return attachAndWaitForError(link); +}, 'link rel=modulepreload with integrity mismatch'); +  </script>  </body>